<?php
namespace app\admin\controller;
use think\facade\Db;
use think\facade\Request;
use think\facade\App;
class Sql extends  Base
{
    public function index() {

$sql1 = "
CREATE TABLE `qing_tongzhi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(5) DEFAULT NULL COMMENT '用户id',
`wxkey` char(255) COMMENT '微信机器人key',
`tixian` int(1) DEFAULT NULL COMMENT '提现通知',
`fufei` int(1) DEFAULT NULL COMMENT '付费通知',
`shuju` int(1) DEFAULT NULL COMMENT '数据提醒',
`jiekou` int(1) DEFAULT NULL COMMENT '接口余额提示',
`gengxin` int(1) DEFAULT NULL COMMENT '更新提醒',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
";
$query = Db::query($sql1);

// ALTER TABLE `表名` ADD `字段` 字段类型”) or die(mysql_error());

$sql="ALTER TABLE `qing_daili` ADD `dwz` char(255)";
$query = Db::query($sql);
    
$dailiData=Db::name('daili')->order('id desc')->select()->toArray();
foreach($dailiData as $k=>$v){
		$dailiData[$k]['dwz']=$dailiData[$k]['id'];
		
$dailiDatas=Db::name('daili')->where('id',$dailiData[$k]['id'])->save($dailiData[$k]);		
}

}
   

}